﻿using System.Windows;
using System.Windows.Navigation;

namespace CoffeeInventory
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            MainFrame.Navigate(new WarehousePage());
        }

        private void WarehouseButtonClick(object sender, RoutedEventArgs e)
        {   
            if (!(MainFrame.Content is WarehousePage))
            {
                MainFrame.Navigate(new WarehousePage());
                MainFrame.RemoveBackEntry();
            }
        }

        private void CounterButtonClick(object sender, RoutedEventArgs e)
        {
            if (!(MainFrame.Content is counterPage))
            {
                MainFrame.Navigate(new counterPage());
                MainFrame.RemoveBackEntry();
            }
        }

        private void MainFrameNavigated(object sender, NavigationEventArgs e)
        {
            if (e.Content is WarehousePage || e.Content is counterPage || e.Content is recipePage || e.Content is SupplierPage)
            {
                MainFrame.RemoveBackEntry();
            }
        }

        private void RecipeButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
			if (!(MainFrame.Content is recipePage))
            {
                MainFrame.Navigate(new recipePage());
                MainFrame.RemoveBackEntry();
            }
        }

        private void SupplierButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	if (!(MainFrame.Content is SupplierPage))
            {
                MainFrame.Navigate(new SupplierPage());
                MainFrame.RemoveBackEntry();
            }
        }
    }
}
